const model = require('../model/model');
const mongoose = require('mongoose');
const basedao=require('../basedao')





class locationProfessiondao extends basedao.basedao{

    

    /* 查询用户职业信息 */
    async queryUserProfession(uid){
      return   model.modellocationProfession.aggregate(
              [
                //            {$match: { 'funcID': mongoose.Types.ObjectId(data) }},      

                        {$match: { 'userid': mongoose.Types.ObjectId(uid)}},
                        /* 关联查询用户信息 */
                        // {$lookup:{
                        //               from:'users',
                        //               localField:'userid',
                        //               foreignField:'_id',
                        //               as:'user'
                        //             }},
                            /* 关联查询类型 */
                        {$lookup:{
                                      from:'professionType',
                                      localField:'professionTypeid',
                                      foreignField:'_id',
                                      as:'profession'
                                    }},
                        /* 关联查询职能 */
                        {$lookup:{
                            from: "profunction",  
                            localField: "profunctionid",  
                            foreignField: "_id",  
                            as: "profunction" 
                          }},
                        /* 关联查询行业 */
                          {$lookup:{
                                from: "industry",  
                                localField: "industryid",  
                                foreignField: "_id",  
                                as: "industry" 
                              }},
                            /* 关联查询 职业 */
                              {$lookup:{
                                    from: "profession",  
                                    localField: "professionid",  
                                    foreignField: "_id",  
                                    as: "profession" 
                                  }}


                      
                  ]
                // ,(err,doc) => {  
                // //     console.log(JSON.stringify(doc))
                //   }

        )
        
    }

}








module.exports=locationProfessiondao

